﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ATM.aspx.cs" Inherits="ATM" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style13
        {
        }
        .style14
        {
            width: 457px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table class="style1" align="center" border="2px">
        <tr>
            <td colspan="2" align="center">
            
                <asp:Label ID="Label1" runat="server" Text="Quản lý điểm ATM" Font-Bold="True" 
                    Font-Size="XX-Large" ForeColor="#FF0066" style="text-align: center"></asp:Label>
                    
            </td>
        </tr>
        <tr>
            <td class="style14" align="center">
                <asp:Label ID="Label5" runat="server" Text="Mã ATM" Font-Bold="True" 
                    Font-Size="Large" ForeColor="#333399"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TxtmaATM" runat="server" style="text-align: left" 
                    Width="274px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style14" align="center">
                <asp:Label ID="Label2" runat="server" Text="Mã khu vực" Font-Bold="True" 
                    Font-Size="Large" ForeColor="#333399"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddlmakhuvuc" runat="server" DataSourceID="SqlDataSource1" 
                    DataTextField="Tinh" DataValueField="MaKhuVuc" Height="25px" Width="273px">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:VietComBankConnectionString %>" 
                    DeleteCommand="DELETE FROM [KhuVuc] WHERE [MaKhuVuc] = @MaKhuVuc" 
                    InsertCommand="INSERT INTO [KhuVuc] ([Tinh]) VALUES (@Tinh)" 
                    SelectCommand="SELECT * FROM [KhuVuc] ORDER BY [MaKhuVuc]" 
                    UpdateCommand="UPDATE [KhuVuc] SET [Tinh] = @Tinh WHERE [MaKhuVuc] = @MaKhuVuc">
                    <DeleteParameters>
                        <asp:Parameter Name="MaKhuVuc" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Tinh" Type="String" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Tinh" Type="String" />
                        <asp:Parameter Name="MaKhuVuc" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td class="style14" align="center">
                <asp:Label ID="Label4" runat="server" Text="Tên máy ATM" Font-Bold="True" 
                    Font-Size="Large" ForeColor="#333399"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="Txttenmay" runat="server" Width="283px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style14" align="center">
                <asp:Label ID="Label3" runat="server" Text="Địa chỉ" Font-Bold="True" 
                    Font-Size="Large" ForeColor="#333399"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="Txtdiachi" runat="server" Width="282px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style14" align="center">
                <asp:Label ID="Label6" runat="server" Text="Latitude" Font-Bold="True" 
                    Font-Size="Large" ForeColor="#333399"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="Txtlat" runat="server" Width="280px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style14" align="center">
                <asp:Label ID="Label7" runat="server" Text="Longtitude" Font-Bold="True" 
                    Font-Size="Large" ForeColor="#333399"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="Txtlong" runat="server" Width="279px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style14" align="center">
                <asp:Label ID="Label8" runat="server" Text="Thông tin" Font-Bold="True" 
                    Font-Size="Large" ForeColor="#333399"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="Txtthongtin" runat="server" Width="277px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style14" align="center">
                <asp:Label ID="Label9" runat="server" Text="Kích hoạt" Font-Bold="True" 
                    Font-Size="Large" ForeColor="#333399"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddlkichhoat" runat="server" Height="21px" Width="279px"
                    style="margin-left: 0px" >
                   <asp:ListItem Value="0">Không kích hoạt</asp:ListItem>
                   <asp:ListItem Value="1">Kích hoạt</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style14" align="center">
                <asp:Button ID="Btthem" runat="server" Text="Thêm" onclick="Btthem_Click" 
                    Width="98px" />
            </td>
            <td>
                <asp:Button ID="Btsua" runat="server" Text="Sửa" onclick="Btsua_Click" 
                    style="margin-left: 0px;" Width="70px" />
&nbsp;&nbsp;
                <asp:Button ID="Btxoa" runat="server" Text="Xóa" onclick="Btxoa_Click" 
                    Width="85px" />
            </td>
        </tr>
        <tr>
            <td class="style13" align="left" colspan="2">
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                    BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
                    DataKeyNames="MaATM" DataSourceID="SqlDataATM">
                    <Columns>
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                        <asp:BoundField DataField="MaATM" HeaderText="Mã ATM" InsertVisible="False" 
                            ReadOnly="True" SortExpression="MaATM" />
                        <asp:BoundField DataField="MaKhuVuc" HeaderText="Mã Khu Vực" 
                            SortExpression="MaKhuVuc" />
                        <asp:BoundField DataField="TenmayATM" HeaderText="Tên Máy ATM" 
                            SortExpression="TenmayATM" />
                        <asp:BoundField DataField="Diachi" HeaderText="Địa chỉ" 
                            SortExpression="Diachi" />
                        <asp:BoundField DataField="Latitude" HeaderText="Latitude" 
                            SortExpression="Latitude" />
                        <asp:BoundField DataField="Longtitude" HeaderText="Longtitude" 
                            SortExpression="Longtitude" />
                        <asp:BoundField DataField="ThongTin" HeaderText="Thông tin" 
                            SortExpression="ThongTin" />
                        <asp:CheckBoxField DataField="IsActive" HeaderText="Kích hoạt" 
                            SortExpression="IsActive" />
                    </Columns>
                    <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                    <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                    <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                    <RowStyle BackColor="White" ForeColor="#003399" />
                    <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                    <SortedAscendingCellStyle BackColor="#EDF6F6" />
                    <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                    <SortedDescendingCellStyle BackColor="#D6DFDF" />
                    <SortedDescendingHeaderStyle BackColor="#002876" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataATM" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:VietComBankConnectionString %>" 
                    DeleteCommand="DELETE FROM [ThongTinATM] WHERE [MaATM] = @MaATM" 
                    InsertCommand="INSERT INTO [ThongTinATM] ([MaKhuVuc], [TenmayATM], [Diachi], [Latitude], [Longtitude], [ThongTin], [IsActive]) VALUES (@MaKhuVuc, @TenmayATM, @Diachi, @Latitude, @Longtitude, @ThongTin, @IsActive)" 
                    SelectCommand="SELECT * FROM [ThongTinATM]" 
                    UpdateCommand="UPDATE [ThongTinATM] SET [MaKhuVuc] = @MaKhuVuc, [TenmayATM] = @TenmayATM, [Diachi] = @Diachi, [Latitude] = @Latitude, [Longtitude] = @Longtitude, [ThongTin] = @ThongTin, [IsActive] = @IsActive WHERE [MaATM] = @MaATM">
                    <DeleteParameters>
                        <asp:Parameter Name="MaATM" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="MaKhuVuc" Type="Int32" />
                        <asp:Parameter Name="TenmayATM" Type="String" />
                        <asp:Parameter Name="Diachi" Type="String" />
                        <asp:Parameter Name="Latitude" Type="Double" />
                        <asp:Parameter Name="Longtitude" Type="Double" />
                        <asp:Parameter Name="ThongTin" Type="String" />
                        <asp:Parameter Name="IsActive" Type="Boolean" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="MaKhuVuc" Type="Int32" />
                        <asp:Parameter Name="TenmayATM" Type="String" />
                        <asp:Parameter Name="Diachi" Type="String" />
                        <asp:Parameter Name="Latitude" Type="Double" />
                        <asp:Parameter Name="Longtitude" Type="Double" />
                        <asp:Parameter Name="ThongTin" Type="String" />
                        <asp:Parameter Name="IsActive" Type="Boolean" />
                        <asp:Parameter Name="MaATM" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
    </table>

</asp:Content>

